import upload from '@/utils/upload'
import request from '@/utils/request'

// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
	const data = {
		oldPassword,
		newPassword
	}
	return request({
		url: '/system/user/profile/updatePwd',
		method: 'put',
		params: data
	})
}

// 查询用户个人信息
export function getUserProfile() {
	return request({
		url: '/system/user/profile',
		method: 'get'
	})
}

// 修改用户个人信息
export function updateUserProfile(data) {
	return request({
		url: '/system/user/profile',
		method: 'put',
		data: data
	})
}

// 用户头像上传
export function uploadAvatar(data) {
	return upload({
		url: '/system/user/profile/avatar',
		name: data.name,
		filePath: data.filePath
	})
}

// 查询字典值
export function dictType(data) {
	return request({
		url: '/system/dict/data/type/' + data,
		method: 'get',
	})
}

//查询邀请信息
export function getInviteInfo() {
	return request({
		'url': '/system/user/getInviteInfo',
		'method': 'get'
	})
}

//查询账户信息
export function getBalanceInfo() {
	return request({
		'url': '/system/user/getBalanceInfo',
		'method': 'get'
	})
}

export function getMineInfo() {
	return request({
		'url': '/system/user/getMineInfo',
		'method': 'get'
	})
}

export function getTeamDetail(type) {
	return request({
		'url': '/system/user/getTeamDetail/' + type,
		'method': 'get'
	})
}



//签到
export function userSign() {
	return request({
		'url': '/userSign/sign',
		'method': 'post'
	})
}

//签到
export function receiveBouns(data) {
	return request({
		'url': '/redEnvelope/receive',
		'method': 'post',
		'data': data
	})
}

export function redEnvelopeList(data) {
	return request({
		'url': '/redEnvelope/list',
		'method': 'get',
		'data': data
	})
}

//积分兑换 
export function integralExchange(data) {
	return request({
		'url': '/integral/exchange',
		'method': 'post',
		'data': data
	})
}

//LMP兑换 
export function coinExchange(data) {
	return request({
		'url': '/coinInfo/exchange',
		'method': 'post',
		'data': data
	})
}


//抽奖项查询
export function raffleList(data) {
	return request({
		'url': '/raffle/list',
		'method': 'get',
		'data': data
	})
}

//抽奖 
export function raffleRaffle(data) {
	return request({
		'url': '/raffle/raffle',
		'method': 'post',
		'data': data
	})
}

//抽奖 
export function pledgeList() {
	return request({
		'url': '/pledge/list',
		'method': 'get'
	})
}